package com.结构型模式.适配器模式;

/**
 * 双向目标统一接口
 */
interface TwoWayTarget{
    void request();
}

/**
 * 目标实现
 */
class TargetRealize implements  TwoWayTarget{
    @Override
    public void request() {
        System.out.println("日了妹妹日姐姐");
    }
}

/**
 * 双向适配者
 */
interface   TwoWayAdaptee{
    void specificRequest();
}

/**
 * 适配者实现
 */
class AdapteeRealize implements TwoWayAdaptee{
    @Override
    public void specificRequest() {
        System.out.println("日了姐姐日妹妹");
    }
}

class TwoWay  implements TwoWayAdaptee,TwoWayTarget{
    TwoWayTarget target  = new TargetRealize();
    TwoWayAdaptee adaptee = new AdapteeRealize();
//    TwoWay(TwoWayAdaptee adaptee){
//        this.adaptee = adaptee;
//    }
//    TwoWay(TwoWayTarget target){
//        this.target = target;
//    }
    @Override
    public void request() {

        adaptee.specificRequest();
    }

    @Override
    public void specificRequest() {
        target.request();
    }
}
/**
 * 双向适配器
 */
public class TwoWayAdapter {
    public static void main(String[] args) {
        TwoWay twoWay = new TwoWay();
        twoWay.request();
        twoWay.specificRequest();
    }

    }

